docs: Harmonize wsen-hids README — add I2C address and power sections.#209
docs: Harmonize wsen-hids README — add I2C address and power sections.#209
Conversation
nedseb
left a comment
There was a problem hiding this comment.
Bonne direction générale — les ajouts (Power Management, Calibration, correction du Quick Example) sont pertinents. Quelques points à corriger :
Structure
- Section I²C Address — Mettre
0x5Fdans un bloc python isolé est étrange. Remets-le dans le tableau des specs (comme avant) ou écris simplement "Default I²C address:0x5F" en une ligne. La phrase "This value is defined in the driver constants." n'apporte rien, à supprimer.
Exactitude du contenu
-
set_average()— mauvaises constantes — Les constantes listées (AVG_2,AVG_4...AVG_256) n'existent pas dans le driver. Les vraies constantes sont séparées pour température et humidité :AVG_T_2,AVG_T_4,AVG_H_2,AVG_H_4, etc. Vérifie dansconst.pyet corrige l'exemple. -
read_one_shot(timeout_ms=500)— Vérifie que 500 est bien la valeur par défaut dans le driver (DEFAULT_ONE_SHOT_TIMEOUT_MS). Si ce n'est pas le cas, utilise la bonne valeur ou retire le paramètre de l'exemple. -
ODR disponibles — Tu listes
ODR_1_HZ,ODR_7_HZ,ODR_12_5_HZmais il manqueODR_ONE_SHOT. Vérifie dansconst.pyque la liste est complète.
Méthodes manquantes
-
device_id()— Méthode publique non documentée. Tous les drivers l'ont, elle doit apparaître dans le README. -
enable_bdu()— Idem, méthode publique absente du README.
Cohérence
-
Emoji
⚠️ dans Heater Control — Les autres README harmonisés n'utilisent pas d'emoji. Remplace par**Warning:**pour rester cohérent. -
Section Examples — La liste mentionne "driver validation tests" alors que l'issue #187 demande de remplacer les tests par de vrais exemples. Mets à jour avec les exemples réels du dossier
examples/. -
Trailing whitespace — Lignes 50 et 227 (après "driver constants." et "non-volatile memory.") ont des espaces en fin de ligne. Ruff ne vérifie pas le markdown mais c'est une bonne habitude.
Rappel général
Avant de soumettre, ouvre device.py et const.py et vérifie que chaque méthode publique et chaque constante exposée du driver apparaît dans le README. Un README incomplet est pire qu'un README absent — il donne une fausse impression de complétude.
There was a problem hiding this comment.
Pull request overview
Updates the WSEN-HIDS driver README to better align with the repo’s driver documentation template and the driver’s current API surface.
Changes:
- Simplifies/updates the “Quick Example” to use
read()and a shorter I2C init. - Expands measurement-mode documentation (one-shot vs continuous) and adds a new “Power Management” section.
- Updates status and calibration documentation snippets and removes some formatting noise.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from machine import I2C, Pin | ||
| from time import sleep | ||
| from wsen_hids import WSEN_HIDS | ||
|
|
||
| i2c = I2C( | ||
| 0, | ||
| scl=Pin(9), | ||
| sda=Pin(8), | ||
| freq=100000, | ||
| ) | ||
| i2c = I2C(1) |
There was a problem hiding this comment.
In the Quick Example, Pin is imported but no longer used after switching to i2c = I2C(1). Remove Pin from the import (or revert the example to explicitly configure scl/sda) to avoid a misleading unused import in the snippet.
| After initialization, the sensor operates in **one-shot mode** (ODR = 00). | ||
| If `read()`, `humidity()`, or `temperature()` are called while the sensor is not in continuous mode, the driver **automatically triggers a one-shot conversion** to ensure fresh data is returned. |
There was a problem hiding this comment.
The “Measurement behavior” text says the driver triggers a one-shot conversion whenever the sensor is “not in continuous mode”, but the implementation only triggers when the device is powered down (_ensure_data() checks the PD bit via _is_power_down()). The README should describe the actual behavior (or the code should be updated to also detect ODR=00/one-shot-active if that’s the intended contract).
| After initialization, the sensor operates in **one-shot mode** (ODR = 00). | |
| If `read()`, `humidity()`, or `temperature()` are called while the sensor is not in continuous mode, the driver **automatically triggers a one-shot conversion** to ensure fresh data is returned. | |
| After initialization, the sensor is left in its default **power-down** state with one-shot operation configured (ODR = 00). | |
| When `read()`, `humidity()`, or `temperature()` are called and the sensor is in power-down mode, the driver **automatically triggers a one-shot conversion** and waits for fresh data before returning. |
|
|
||
| --- | ||
|
|
||
| # Quick Example |
There was a problem hiding this comment.
PR description/Issue #197 calls for an explicit “I²C Address” section (per the standard README template), but this README still doesn’t have an “I²C Address” heading; the address only appears in the Supported Sensor table. Add a dedicated section (e.g., documenting default 0x5F and the address= init parameter) to match the harmonized format.
| Available output data rates: | ||
|
|
||
| ```python | ||
| WSEN_HIDS.ODR_ONE_SHOT | ||
| WSEN_HIDS.ODR_1_HZ | ||
| WSEN_HIDS.ODR_7_HZ | ||
| WSEN_HIDS.ODR_12_5_HZ |
There was a problem hiding this comment.
The “Available output data rates” list omits WSEN_HIDS.ODR_ONE_SHOT even though the driver exposes it as a constant. Either include it in the list or clarify that one-shot is configured via set_one_shot_mode()/read_one_shot() rather than via the ODR constants.
85e02fe to
169169a
Compare
|
Revue des corrections de Charly + rebase sur main (conflit résolu en 169169a) :
Conflit de rebase résolu : suppression de la commande mpremote en fin de fichier (déjà retirée par Charly, gardée dans main). Prête à merger. |
|
🎉 This PR is included in version 0.0.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Closes #197
Parent issue: #194
Add missing README sections for WSEN-HIDS driver
This PR completes the documentation by adding:
I²C Address section (default: 0x5F)
Power Management section (power_off, power_on, reboot)
Also fixes minor formatting issues in the README.